<template class="dashboard-container">
    <div align="center">
        <div style="margin-top: 75px; margin-left: 60px;">
            
            <h3>修改</h3>
        </div>
        <el-divider></el-divider>
        <el-radio-group v-model="formLabelAlign" size="small">
        </el-radio-group>
        <div style="margin-left:20px;">
            <el-form label-width="80px" style="width: 50%;">
                <el-form-item label="ID">
                    <el-input v-model="formLabelAlign.id" class="size"></el-input>
                    <label style="margin-left: 90px;">商品：</label>
                    <el-input v-model="formLabelAlign.goods" class="size"></el-input>
                </el-form-item>
                <el-form-item label="仓库">
                    <el-input v-model="formLabelAlign.storehouse" class="size"></el-input>
                    <label style="margin-left: 90px;">分类：</label>
                    <el-input v-model="formLabelAlign.category" class="size"></el-input>
                </el-form-item>
                <el-form-item label="数量">
                    <el-input v-model="formLabelAlign.quantity" class="size"></el-input>
                    <label style="margin-left: 90px;">备注：</label>
                    <el-input v-model="formLabelAlign.remark" class="size"></el-input>
                </el-form-item>
            </el-form>
            <router-link to="/GoodsManage/GoodsManage">
            <el-button type="primary" @click="update()">确 定</el-button>
            </router-link>
            <router-link to="/GoodsManage/GoodsManage">
            <el-button type="primary">取 消</el-button>
        </router-link>
        <el-divider></el-divider>

        </div>
    </div>
</template>
<script>
import { sel, upd } from '@/api/Goods'
export default {
    data() {
        return {
            labelPosition: 'left',
            formLabelAlign: {
                role: '用户'
            },
            options: [{
                value: '仓库一',
                label: '仓库一'
            }, {
                value: '仓库aaa',
                label: '仓库aaa'
            }]
        }
    },

    created() {
        this.sel()
    },

    methods: {
        //信息查询
        sel() {
            this.res = this.$route.query.id
            sel(this.$route.query.id).then(res => {
                this.formLabelAlign = res.data.data
            })
        },

        //修改
        update() {
            upd(this.formLabelAlign).then(res => {
                //修改成功
                this.$message.success("修改成功");
                //修改成功后路由跳转到GoodsManage.vue
                this.$router.push('/GoodsManage');
            })
        }
    }
}
</script>
<style>
.size {
    height: 100%;
    width: 35%;
}

/* 背景颜色渐变 */
.background-color {
    background: linear-gradient(135deg, #a1c4fd, #c2e9fb);
    height: 100%;

}

.size {
    height: 100%;
    width: 35%;
}
</style>